home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / System / Directory source / error.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-09-27  |  588 b   |  48 lines  |  [TEXT/KAHL]

  1. /*    Error.c
  2.  *
  3.  *    Error management routines
  4.  */
  5.  
  6. #include <unix.h>
  7. #include <stdio.h>
  8. #include "error.h"
  9. #include "res.h"
  10.  
  11.  
  12.  
  13.  
  14. jmp_buf callStack[MAXJUMP];
  15. short callStackPtr;
  16.  
  17.  
  18. /*    Throw
  19.  *
  20.  *    This 'throws' the error message back to the 'catch' routine
  21.  */
  22.  
  23. void Throw(i)
  24. int i;
  25. {
  26.     if (callStackPtr > 0) {
  27.         callStackPtr--;
  28.         longjmp(callStack[callStackPtr],i);
  29.     }
  30. }
  31.  
  32.  
  33.  
  34. /*    PostError
  35.  *
  36.  *    This posts the error message specified to the screen.
  37.  */
  38.  
  39. void PostError(i)
  40. int i;
  41. {
  42.     char buffer[255];
  43.  
  44.     GetIndString(buffer,ERRORSTRS,i);
  45.     ParamText(buffer,NULL,NULL,NULL);
  46.     Alert(ERRORALRT,NULL);
  47. }
  48.